﻿using Microsoft.AspNetCore.Mvc;
using TXTD.Admin.Data.Entitys.System;
using TXTD.Admin.Interface.System;
using TXTD.Admin.Model.Core;

namespace TXTD.Admin.WebApi.Modules.System
{
    [ApiController]
    [Route("api/System/[controller]")]
    public class SysConfigController : ControllerBase
    {
        private ISysConfigService service;
        public SysConfigController(ISysConfigService _service)
        {
            service = _service;
        }
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetPageList")]
        public ResultModel GetPageList([FromQuery] SysConfig model)
        {
            return ResultModel.ResultBy(service.GetPageList(model));
        }
        [HttpPost("Add")]
        public ResultModel Add(SysConfig model)
        {
            return ResultModel.ResultByCount(service.Add(model));
        }
        [HttpPost("Update")]
        public ResultModel Update(SysConfig model)
        {
            return ResultModel.ResultByCount(service.Update(model));
        }
        [HttpPost("Delete")]
        public ResultModel Delete(string id)
        {
            return ResultModel.ResultByCount(service.DeleteById(id));
        }
    }
}
